package com.jz.demo.controller;

import com.jz.demo.entity.Contact;
import com.jz.demo.mapper.ContactMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName : ContactController  //类名
 * @Description :   //描述
 * @Author : 岚氓  //作者
 * @Date: 2020-11-07 18:56  //时间
 * @Version 1.0
 */
@Controller
@RequestMapping("contact")
public class ContactController {
    @Autowired
    private ContactMapper contactMapper;

    @PostMapping("insertcontact")
    private String insertcontact(Contact contact){
        contactMapper.insertContact(contact);
        return "redirect:/index";
    }


    @GetMapping("findContact")
    @ResponseBody
    private List<Contact> findContact(){
        return contactMapper.findContact();
    }
}
